package com.myssm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.myssm.entity.User;
import com.myssm.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {

	private UserService userService;

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	@RequestMapping("/aduser")
	public String addUser(User user,Model model){
		boolean flag=false;
		flag=userService.addUser(user);
		if (flag) {
			model.addAttribute("info", "添加用户成功");
		}else {
			model.addAttribute("info", "添加用户失败");
		}
		return "page/userList.jsp";
		
	}
}
